package com.job.ZhangMeng.Homework0716;

import java.util.Scanner;

/**
 * 2022.07.16  CharCount降序打印字母个数(未完成)
 * 张孟
 */

public class CharCount{
    Character code;
    Integer count=1;

    public static void deUpperCase(String str){
        char[] chars=str.toCharArray(); //将str转换为数组
        StringBuffer sBf=new StringBuffer();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] >= 'A' && chars[i] <= 'Z') {
                sBf.append(chars[i]);
            }
        }
        char ch;
        String midStr=sBf.toString();
        char[] chars1=midStr.toCharArray();
        for (int i = 0; i < chars1.length-1; i++) {
            for (int j = 0; j < chars1.length-1-i; j++) {
                if(chars1[i]>chars1[j]){
                    ch=chars1[i];
                    chars1[i]=chars1[j];
                    chars1[j]=ch;
                }
            }
        }
    }

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.print("请输入字符串：");
        String input=scanner.nextLine();
        deUpperCase(input);
    }

}
